<?php
class CommentModel extends Model{
    public function comment_article_list($aid){
        if(empty($aid && is_numeric($aid))){
            return false;
        }else{
            $model_member = new MemberModel;
            $member_table = $model_member->table;
            $data = $this->alias('c')->left([$member_table,'m'],'m.id = c.mid')
                  ->where(['c.aid' => $aid])->limit(10)->select();
            return $data;
        }
    }
    public function comment_member_article_list($member_id){
        if(empty($member_id && is_numeric($member_id))){
            return false;
        }else{
            $model_article = new ArticleModel;
            $article_table = $model_article->table;
            $data = $this->alias('c')->left([$article_table,'a'],'c.aid = a.id')
                  ->where(['c.mid' => $member_id])->limit(10)->select();
            return $data;
        }        
    }
    public function get_by_member_id($member_id){
        if(empty($aid) && is_numeric($member_id)){
            return false;
        }else{
            $data = $this->where(['mid'=>$member_id])->limit(50)->select();
        }
    }
}
